var dbutil = require('../lib/dbutil');
var mongoose = dbutil.getDBConn();
var Schema = mongoose.Schema;
var ObjectId = Schema.ObjectId;

var User = new Schema({
	'user_id':ObjectId,
	'username':{type:String, index:true},
	'passwd':String,
	'email':{ type: String, index:true }
});

mongoose.model('User', User);

var Picture = new Schema({
	'article_id':ObjectId,
	'title':String,
	'author':[User],
	'filePath':String,
	'describtion':String,
	'createDate':Date
});

mongoose.model('Picture', Picture);

exports.get = function(modelName){
	return mongoose.model(modelName);
}
